<template>
    <div>
        <iframe :src="screenUrl" ref="myIframe" @load="iframeLoaded" width="100%" :height="screenHeight" id="myiframe"></iframe>
    </div>
</template>
<script>
  import ApiUrl from '@/api/apiUrls' // dengshunbo 2024-12-27新增
  export default {
    data() {
      return {
        loading: false,
        loasturl: ApiUrl,  // dengshunbo 2024-12-27新增
        externalContent: '',
        tokenval: '',
        screenUrl:'https://erp.langsenkeji.com/g/1.html',
        screeniframUrl: '',
        iframeShow: false,
        screenHeight: 1000,
      }
    },
   
    created() {
      this.updateScreenHeight();
    },
    mounted() {
      window.addEventListener('resize', this.updateScreenHeight);
    },
    methods: {
        updateScreenHeight() {
          this.screenHeight = window.innerHeight;
          console.log("window.innerHeight", this.screenHeight)
        },
        iframeLoaded(event) {
            setTimeout(()=>{
            this.tokenval = window.localStorage.getItem("token")
            const iframeWindow = this.$refs.myIframe.contentWindow;
            iframeWindow.postMessage({ token: this.tokenval, isflag: true, apiUrl: this.screenUrl }, '*');
            }, 100)
        },
    }
  }
</script>
<style scoped lang="scss">
  .img {
    cursor: pointer;
    display: block;
    width: 50px;
    height: 50px;
    margin-right: 4px;
    margin-bottom: 4px;
  }
  .flex_box {
    width: 100%;
    padding: 0 10px;
    display: flex;
  
    .tips {
      span {
        margin-right: 4px;
      }
    }
  }
  .img-box {
    display: flex;
    flex-wrap: wrap;
  }
  </style>
  